#ifndef _GVECTOR_H_
#define _GVECTOR_H_

#include <vector>

template<typename T>
class BBVector
{
public:
	BBVector(void);
	~BBVector(void);
	void Push(T obj);
	int Length();
	T getObjectAtIndex(int index);
	void Remove(T obj);
	int indexAt(T obj);
	bool isEmpty();
	void Clear();
private:
	std::vector<T> m_VectorList;
};


template<typename T>
BBVector<T>::~BBVector( void )
{	
}

template<typename T>
BBVector<T>::BBVector( void )
{
}	

template<typename T>
bool BBVector<T>::isEmpty()
{
	return m_VectorList.size() == 0;
}


template<typename T>
int BBVector<T>::indexAt( T obj )
{
	int index;
	std::vector<T>::iterator itor = m_VectorList.begin();
	for(;itor!=m_VectorList.end();itor++)
	{
		if(*itor == obj)
			return index;
		index++;
	}
	return -1;
}


template<typename T>
int BBVector<T>::Length()
{
	return m_VectorList.size();
}

template<typename T>
void BBVector<T>::Remove( T obj )
{
	std::vector<T>::iterator itor = m_VectorList.begin();
	for(;itor!=m_VectorList.end();itor++)
	{
		if(*itor == obj)
		{
			m_VectorList.erase(itor);
			return;
		}
	}
}

template<typename T>
T BBVector<T>::getObjectAtIndex( int index )
{
	if(index <0 || index>=Length())
		return NULL;
	return m_VectorList[index];
}

template<typename T>
void BBVector<T>::Push( T obj )
{
	m_VectorList.push_back(obj);
}


template<typename T>
void BBVector<T>::Clear()
{
	m_VectorList.clear();
}



#endif